<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header');
?>
<script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>Pager.class.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo JS_PATH?>DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
var pager = new Pager();
pager.model = "?m=sale&c=opportunitymanage";
pager.nid = "opportunity_id";
function init_page(){
	var url = window.location.pathname;
	$.ajax({
		url:url+'?'+set_ajx_url('m=sale&c=opportunitymanage&a=ajx_init'),
		data:'', 
		type:'post',
		dataType:'json',
		success:function(data){
		pager.setEdit();
		pager.setDel();		
		$('#main_tbody').html(pager.getPageTable(data["page_head"],data["page_data"]));
		$('.main_foot_wraper').html(pager.getPageState(data["page_state"]));
		},error:function(){
			alert(url+'?'+set_ajx_url('m=sale&c=opportunitymanage&a=ajx_init'));}
	});
}
function print_r(theObj) {
	    var retStr = '';
	   if (typeof theObj == 'object') {
	       retStr += '<div style="font-family:Tahoma; font-size:7pt;">';
	        for (var p in theObj) {
           if (typeof theObj[p] == 'object') {
	               retStr += '<div><b>['+p+'] => ' + typeof(theObj) + '</b></div>';
	               retStr += '<div style="padding-left:25px;">' + print_r(theObj[p]) + '</div>';
	            } else {
	               retStr += '<div>['+p+'] => <b>' + theObj[p] + '</b></div>';
	             }
        }
       retStr += '</div>';
	   }
	    return retStr;
	}

</script>
<body onLoad="init_page()"> 
<div class="main_head">
		<span class="main_head_title">销售机会管理</span>	
		<a href="?m=sale&c=opportunitymanage&a=add"><span class="main_head_btn">新&nbsp;&nbsp;增</span></a>	
</div>

<div class="search_frame">
	<div class="search_Within">
		<div class="search_radio_box">
			<img src="images/search.gif" width="43" height="28" class="search_ico"/>
		</div>
		<div class="search_form_left">
			<div class="search_form_text">销售机会名称：</div>
			<div class="search_input_left"><input name="textfield" type="text" class="txt" id="_con_opportunity_name"/></div>
			<div class="search_form_text">来源：</div>
			<div class="search_input_left">
			<select id="_con_opportunity_source" class="select">
			<option value=""></option>
            <?php 
            	foreach ($option_cache['opportunity_source']  as $key => $value) {
            ?>
			<option value="<?php echo $key?>"><?php echo $value?></option>
			<?php 
            	}
			?>
			</select></div><br/><br/>
			<div class="search_form_text">发现时间：</div>
			<div class="search_input_left"><input name="textfield" type="text" class="txt choose_date" id="_con_opportunity_data_d1" onClick="WdatePicker()"/></div>
			<div class="search_input_left">-<input name="textfield" type="text" class="txt choose_date" id="_con_opportunity_data_d2" onClick="WdatePicker()"/></div>
            
		</div>
		<div class="search_form_right">
			<div class="search_form_text">阶段：</div>
			<div class="search_input_left">
			<select  class="select" id="_con_opportunity_stage">
			<option value=""></option>
			<?php foreach ($option_cache['opportunity_stage'] as $key=>$value) {?>
				<option value="<?php echo$key?>"><?php echo $value?></option>
			<?php }?>
			</select></div>
			<div class="search_form_text">可能性：</div>
			<div class="search_input_left">
			<select id="_con_opport_possibility" class="select">
			<option value=""></option>
            <?php 
            	foreach ($option_cache['opport_possibility']  as $key => $value) {
            ?>
			<option value="<?php echo $key?>"><?php echo $value?></option>
			<?php 
            	}
			?>
			</select></div><br/><br/>
			<div class="search_form_text">状态：</div>
			<div class="search_input_left">
			<select id="_con_opport_status" class="select">
			<option value=""></option>
            <?php 
            	foreach ($option_cache['opport_status']  as $key => $value) {
            ?>
			<option value="<?php echo $key?>"><?php echo $value?></option>
			<?php 
            	}
			?>
			</select></div>
		</div>
		<div class="search_btn"><input name="dosubmit" type="submit" class="search_btn_a" value=" 查询 " onClick="pager.search()"/></div>
    </div>
</div>

<div class="main_wraper">
<table border="0" cellpadding="0" cellspacing="0" class="main_table">
	<thead>
		<tr class="main_table_header">
			<th width="4%">序号</th>
			<th width="5%">销售机会名称</th>
			<th width="10%">来源</th>
			<th width="12%">阶段</th>
			<th width="12%">可能性</th>
			<th width="10%">状态</th>
			<th width="10%" colspan=2>操作</th>						
		</tr>
	</thead>
	<tbody id = "main_tbody">
	
	</tbody>
</table>
</div>
<div class="main_foot_wraper">

</div>

</body>
</html>